package org.git.movie.videojiexi.enums;


import java.util.HashMap;
import java.util.Map;

public enum VideoChannel {

    DOUYIN("DOUYIN", "抖音"),
    KUAISHOU("KUAISHOU", "快手"),
    TencentQq("TencentQq", "腾讯视频"),
    TencentQqV2("TencentQqV2", "腾讯视频V2"),
    SoGou("SoGou", "搜狗视频"),
    WEISHI("WEISHI", "微视");

    private String key;
    private String desc;

    private VideoChannel(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public String getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    private  static Map<String,VideoChannel> keyMaps = new HashMap<>();

    public static VideoChannel getByKeys(String key){

        if(keyMaps.isEmpty()){
            synchronized (VideoChannel.class){
                if(keyMaps.isEmpty()){
                    VideoChannel[] values = VideoChannel.values();
                    for(VideoChannel v: values){
                        keyMaps.put(v.getKey(),v);
                    }
                }
            }
        }
        return keyMaps.get(key);

    }
}
